package com.wanhe.shoppingcart.counter;

import com.wanhe.shoppingcart.cuiyu.ChuiSecLevelDialogCounter;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XieZaiWei on 2017/5/9.
 * 用于绑定菜品类和计数器分类关联关系的配置类
 */

public class CounterConfig {
	public static final String BASE_DISH_TYPE = "base";
	public static final String VIDEO_DISH_TYPE = "video";
	public static final String IMAGE_DISH_TYPE = "image";
	public static final String GIF_DISH_TYPE = "gif";
	public static final String HIT_DISH_TYPE = "hit";
	public static final String GIF_ARR_DISH_TYPE = "gifarray";
	public static final String ADD_ONCE_FOUR_TIMES_TYPE = "min4";


	//======================================脆鱼版本======================================
	public static final String CHUIYU_TAOCAN_TYPE = "tao";


	private static CounterConfig ourInstance;

	public static CounterConfig getInstance() {

		if (ourInstance == null) {
			ourInstance = new CounterConfig();
		}

		return ourInstance;
	}

	private CounterConfig() {
	}

	private Map<String, String> mappingConfig = new HashMap<>();

	/**
	 * 添加绑定关联关系
	 *
	 * @author 陈德基
	 * created at 2016/11/4 14:49
	 */
	private CounterConfig addMapping(String dishType, String counterType) {
		this.mappingConfig.put(dishType, counterType);
		return this;
	}

	public String getCounterType(String dishType) {
		return this.mappingConfig.get(dishType);
	}

	public void init() {
		addMapping(BASE_DISH_TYPE, ShowSecLevelDialogCounter.COUNTER_TYPE)
				.addMapping(GIF_ARR_DISH_TYPE, OnlyOneExistCounter.COUNTER_TYPE)
				.addMapping(ADD_ONCE_FOUR_TIMES_TYPE, AddFourTimeCounter.COUNTER_TYPE)
				.addMapping(CHUIYU_TAOCAN_TYPE, ChuiSecLevelDialogCounter.COUNTER_TYPE);
	}
}
